'''
网格式布局
'''

import matplotlib.pyplot as mp
import matplotlib.gridspec as mg

mp.figure('Gridspec',facecolor='lightgray')
#调用Gridspec（）方法拆分成网格式布局

gs = mg.GridSpec(3,3)#转化成三行三列的形式
#合并  0行的0列,1列合并为一个子图表
mp.subplot(gs[0,:2])
mp.text(0.5,0.5,1,va = 'center',ha = 'center',size = 36,alpha = 0.8)
mp.xticks([])
mp.yticks([])
mp.tight_layout()#紧凑式布局

mp.subplot(gs[:2,2])
mp.text(0.5,0.5,2,va = 'center',ha = 'center',size = 36,alpha = 0.8)
mp.xticks([])
mp.yticks([])
mp.tight_layout()#紧凑式布局

mp.subplot(gs[1,1])
mp.text(0.5,0.5,3,va = 'center',ha = 'center',size = 36,alpha = 0.8)
mp.xticks([])
mp.yticks([])
mp.tight_layout()#紧凑式布局

mp.subplot(gs[1:,0])
mp.text(0.5,0.5,4,va = 'center',ha = 'center',size = 36,alpha = 0.8)
mp.xticks([])
mp.yticks([])
mp.tight_layout()#紧凑式布局

mp.subplot(gs[2,1:])
mp.text(0.5,0.5,5,va = 'center',ha = 'center',size = 36,alpha = 0.8)
mp.xticks([])
mp.yticks([])
mp.tight_layout()#紧凑式布局


mp.show()
